﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="SaleManager.aspx.cs" Inherits="SaleManager" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">

    <asp:UpdatePanel ID="upUpdatePanle" runat="server">
        <ContentTemplate>
            <asp:DropDownList ID="ddlNavigationMode" runat="server" DataSourceID="NavigationModeDS" CssClass="textbox"
                DataTextField="Name" DataValueField="NavigationModeID">
            </asp:DropDownList>
            <asp:TextBox ID="txtNavigationModeDiscount" runat="server" CssClass="textbox"></asp:TextBox>
            <asp:RequiredFieldValidator ValidationGroup="NavigationValidation" ID="val5" runat="server" ControlToValidate="txtNavigationModeDiscount" EnableClientScript="true" ErrorMessage="*"></asp:RequiredFieldValidator>
            <asp:CompareValidator ID="cmprValidatorDoubleType1" runat="server" ControlToValidate="txtNavigationModeDiscount" Type="Double" Display="Dynamic" Operator="DataTypeCheck"
                ErrorMessage="* Not a valid number." ValidationGroup="NavigationValidation"></asp:CompareValidator>
            <div id="ModuleContent">
                <ul class="NavigationButtons">
                    <li>
                        <asp:LinkButton ID="btnAddNavigationModeSale" ValidationGroup="NavigationValidation" CssClass="navigation_button" Text="Add" runat="server" OnClick="btnAddNavigationModeSale_Click" />
                    </li>
                </ul>
            </div>
            <asp:Label ID="lblAddNavigationSaleError" ForeColor="Red" Visible="false" Text="Discounts have already been set for this type" runat="server" />
            <br />
            <asp:GridView ID="NavigationSaleGirdView" CssClass="skineedgrid" runat="server" DataSourceID="NavigationModeSaleDS"
                AutoGenerateColumns="false" Width="75%" DataKeyNames="ID"
                AllowPaging="true" PageSize="5">
                <Columns>
                    <asp:BoundField DataField="ID" HeaderText="ID" Visible="False" ReadOnly="true" />
                    <asp:BoundField DataField="Name" HeaderText="Title" ReadOnly="true" />
                    <%--<asp:BoundField DataField="NameGeo" HeaderText="დასახელება(ქართული)" ReadOnly="true" />--%>
                    <asp:TemplateField>
                        <ItemTemplate>
                            <asp:Label ID="lblDiscount" Text='<%#Bind("Discount") %>' runat="server" />
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:TextBox ID="txtDiscount" Text='<%#Bind("Discount") %>' Width="50px" runat="server" />
                            <asp:RequiredFieldValidator ID="val55" runat="server"
                                ControlToValidate="txtDiscount"
                                EnableClientScript="true" ErrorMessage="*"></asp:RequiredFieldValidator>
                            <asp:CompareValidator ID="CompareValidator22" runat="server"
                                ControlToValidate="txtDiscount"
                                Type="Double" Display="Dynamic" Operator="DataTypeCheck"
                                ErrorMessage="* Not a valid number."></asp:CompareValidator>
                        </EditItemTemplate>
                    </asp:TemplateField>
                    <asp:CommandField DeleteText="Delete" ShowDeleteButton="true" ButtonType="Link" CancelText="Cancel" ShowCancelButton="true" />
                    <asp:CommandField EditText="Edit" UpdateText="Save" ShowEditButton="true" ButtonType="Link" CancelText="Cancel" ShowCancelButton="true" />
                </Columns>
            </asp:GridView>
            <br />
            <hr />
            <asp:DropDownList ID="ddlVesselCode" runat="server" DataSourceID="VesselCodeDS"
                DataTextField="Name" DataValueField="VesselCodeID" CssClass="textbox">
            </asp:DropDownList>
            <asp:TextBox ID="txtVesselCode" runat="server" CssClass="textbox"></asp:TextBox>
            <asp:RequiredFieldValidator ValidationGroup="VesselCodeValidation" ID="val1" runat="server"
                ControlToValidate="txtVesselCode" EnableClientScript="true" ErrorMessage="*"></asp:RequiredFieldValidator>
            <asp:CompareValidator ID="CompareValidator1" runat="server" ControlToValidate="txtVesselCode" Type="Double"
                Display="Dynamic" Operator="DataTypeCheck"
                ErrorMessage="* Not a valid number." ValidationGroup="VesselCodeValidation"></asp:CompareValidator>
            <br />
            <asp:LinkButton ID="btnVesselCodeSale" CssClass="navigation_button" Width="60px" Text="Add" runat="server"
                OnClick="btnVesselCodeSale_Click" ValidationGroup="VesselCodeValidation" />

            <asp:Label ID="lblVesselCodeAddError" ForeColor="Red" Visible="false" Text="Discounts have already been set for this type" runat="server" />
            <br />
            <br />
            <br />
            <asp:GridView ID="VesselCodeSaleGridView" CssClass="skineedgrid" runat="server"
                DataSourceID="VesselCodeSaleDS"
                AutoGenerateColumns="false" Width="75%" DataKeyNames="ID"
                AllowPaging="true" PageSize="5">
                <Columns>
                    <asp:BoundField DataField="ID" HeaderText="ID" Visible="False" ReadOnly="true" />
                    <asp:BoundField DataField="Name" HeaderText="Title" ReadOnly="true" />
                    <%--<asp:BoundField DataField="NameGeo" HeaderText="დასახელება(ქართული)" ReadOnly="true" />--%>
                    <asp:TemplateField>
                        <ItemTemplate>
                            <asp:Label ID="lblDiscount" Text='<%#Bind("Discount") %>' runat="server" />
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:TextBox ID="txtDiscount" Text='<%#Bind("Discount") %>' Width="50px" runat="server" />
                            <asp:RequiredFieldValidator ID="val55" runat="server"
                                ControlToValidate="txtDiscount"
                                EnableClientScript="true" ErrorMessage="*"></asp:RequiredFieldValidator>
                            <asp:CompareValidator ID="CompareValidator22" runat="server"
                                ControlToValidate="txtDiscount"
                                Type="Double" Display="Dynamic" Operator="DataTypeCheck"
                                ErrorMessage="* Not a valid number."></asp:CompareValidator>
                        </EditItemTemplate>
                    </asp:TemplateField>
                    <asp:CommandField DeleteText="Delete" ShowDeleteButton="true" ButtonType="Link" CancelText="Cancel" ShowCancelButton="true" />
                    <asp:CommandField EditText="Edit" UpdateText="Save" ShowEditButton="true" ButtonType="Link" CancelText="Cancel" ShowCancelButton="true" />
                </Columns>
            </asp:GridView>

            <hr />
            <asp:DropDownList ID="ddlAdditionalParamForSale" runat="server" DataSourceID="AdditionalParamForSaleDS"
                DataTextField="Name" DataValueField="AdditionalParamForSaleID" CssClass="textbox">
            </asp:DropDownList>
            <asp:TextBox ID="txtAdditionalParamForSale" runat="server" CssClass="textbox"></asp:TextBox>
            <asp:RequiredFieldValidator ValidationGroup="AdditionalParamForSaleValidation" ID="val242" runat="server"
                ControlToValidate="txtAdditionalParamForSale" EnableClientScript="true" ErrorMessage="*">
            </asp:RequiredFieldValidator>
            <asp:CompareValidator ID="CompareValidator2" runat="server" ControlToValidate="txtAdditionalParamForSale"
                Type="Double" Display="Dynamic" Operator="DataTypeCheck" ValidationGroup="AdditionalParamForSaleValidation"
                ErrorMessage="* Not a valid number."></asp:CompareValidator>
            <br />
            <asp:LinkButton ID="btnAdditionalParamForSaleSale" ValidationGroup="AdditionalParamForSaleValidation" CssClass="navigation_button" Width="60px" Text="Add"
                runat="server" OnClick="btnAdditionalParamForSaleSale_Click" />

            <asp:Label ID="lblAdditionalParamForSaleError" ForeColor="Red" Visible="false" Text="Discounts have already been set for this type" runat="server" />
            <br />
            <br />
            <br />
            <asp:GridView ID="AdditionalParamForSaleGridView" CssClass="skineedgrid" runat="server"
                DataSourceID="AdditionalParamForSaleSaleDS"
                AutoGenerateColumns="false" Width="75%" DataKeyNames="ID"
                AllowPaging="true" PageSize="5">
                <Columns>
                    <asp:BoundField DataField="ID" HeaderText="ID" Visible="False" ReadOnly="true" />
                    <asp:BoundField DataField="Name" HeaderText="Title" ReadOnly="true" />
                    <%--<asp:BoundField DataField="NameGeo" HeaderText="დასახელება(ქართული)" ReadOnly="true" />--%>
                    <asp:TemplateField>
                        <ItemTemplate>
                            <asp:Label ID="lblDiscount" Text='<%#Bind("Discount") %>' runat="server" />
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:TextBox ID="txtDiscount" Text='<%#Bind("Discount") %>' Width="50px" runat="server" />
                            <asp:RequiredFieldValidator ID="val55" runat="server"
                                ControlToValidate="txtDiscount"
                                EnableClientScript="true" ErrorMessage="*"></asp:RequiredFieldValidator>
                            <asp:CompareValidator ID="CompareValidator22" runat="server"
                                ControlToValidate="txtDiscount"
                                Type="Double" Display="Dynamic" Operator="DataTypeCheck"
                                ErrorMessage="* Not a valid number."></asp:CompareValidator>
                        </EditItemTemplate>
                    </asp:TemplateField>
                    <asp:CommandField DeleteText="Delete" ShowDeleteButton="true" ButtonType="Link" CancelText="Cancel" ShowCancelButton="true" />
                    <asp:CommandField EditText="Edit" UpdateText="Save" ShowEditButton="true" ButtonType="Link" CancelText="Cancel" ShowCancelButton="true" />
                </Columns>
            </asp:GridView>
        </ContentTemplate>
    </asp:UpdatePanel>

    <asp:ObjectDataSource ID="NavigationModeDS" runat="server" SelectMethod="GetAll" TypeName="DAL.DBManagers.NavigationModesManager"></asp:ObjectDataSource>
    <asp:ObjectDataSource ID="VesselCodeDS" runat="server" SelectMethod="GetAll" TypeName="DAL.DBManagers.VesselCodesManager"></asp:ObjectDataSource>
    <asp:ObjectDataSource ID="AdditionalParamForSaleDS" runat="server" SelectMethod="GetAll" TypeName="DAL.DBManagers.AdditionalParamForSalesManager"></asp:ObjectDataSource>
    <asp:ObjectDataSource ID="NavigationModeSaleDS" runat="server" SelectMethod="GetNavigationModeSales"
        DeleteMethod="Delete" UpdateMethod="Edit" TypeName="DAL.DBManagers.SalesManager">
        <SelectParameters>
            <asp:QueryStringParameter Name="ServiceID" DbType="Guid" QueryStringField="id" />
        </SelectParameters>
        <DeleteParameters>
            <asp:QueryStringParameter Name="ID" DbType="Guid" QueryStringField="id" />
            <asp:Parameter Name="UserID" DbType="Guid" />
        </DeleteParameters>
        <UpdateParameters>
            <asp:QueryStringParameter Name="ID" DbType="Guid" QueryStringField="id" />
            <asp:Parameter Name="UserID" DbType="Guid" />
            <asp:Parameter Name="Discount" DbType="Double" />
        </UpdateParameters>
    </asp:ObjectDataSource>
    <asp:ObjectDataSource ID="VesselCodeSaleDS" runat="server" SelectMethod="GetVesselCodeSales"
        DeleteMethod="Delete" UpdateMethod="Edit" TypeName="DAL.DBManagers.SalesManager">
        <SelectParameters>
            <asp:QueryStringParameter Name="ServiceID" DbType="Guid" QueryStringField="id" />
        </SelectParameters>
        <DeleteParameters>
            <asp:QueryStringParameter Name="ID" DbType="Guid" QueryStringField="id" />
            <asp:Parameter Name="UserID" DbType="Guid" />
        </DeleteParameters>
        <UpdateParameters>
            <asp:QueryStringParameter Name="ID" DbType="Guid" QueryStringField="id" />
            <asp:Parameter Name="UserID" DbType="Guid" />
            <asp:Parameter Name="Discount" DbType="Double" />
        </UpdateParameters>
    </asp:ObjectDataSource>
    <asp:ObjectDataSource ID="AdditionalParamForSaleSaleDS" runat="server" SelectMethod="GetAdditionalForSales"
        DeleteMethod="Delete" UpdateMethod="Edit" TypeName="DAL.DBManagers.SalesManager">
        <SelectParameters>
            <asp:QueryStringParameter Name="ServiceID" DbType="Guid" QueryStringField="id" />
        </SelectParameters>
        <DeleteParameters>
            <asp:QueryStringParameter Name="ID" DbType="Guid" QueryStringField="id" />
            <asp:Parameter Name="UserID" DbType="Guid" />
        </DeleteParameters>
        <UpdateParameters>
            <asp:QueryStringParameter Name="ID" DbType="Guid" QueryStringField="id" />
            <asp:Parameter Name="UserID" DbType="Guid" />
            <asp:Parameter Name="Discount" DbType="Double" />
        </UpdateParameters>
    </asp:ObjectDataSource>
</asp:Content>

